#!/bin/bash

shopt -s extglob

rm -rfv !("requirements.txt"|"install.sh"|"python3.10"|"cv2")
python3.10 -m pip install --no-deps -r requirements.txt -t .

rm pip/__init__.py
cp ../pip_init.py pip/__init__.py

find . -name "__pycache__" -exec rm -rf {} \;

rm -rf sphinx_rtd_theme.zip
zip -r sphinx_rtd_theme sphinx_rtd_theme*
rm -rf sphinx_rtd_theme sphinx_rtd_theme*.dist-info

rm setuptools/_distutils/command/build_ext.py
cp ../Extensions/Dependencies/tools/build_ext.py setuptools/_distutils/command/

cd ../

Extensions/Dependencies/tools/build.sh
Extensions/Dependencies/tools/copy-eggs.sh

find site-packages -name "*.so" -delete
